/////////////////////////////////////////////////////////////////////////////
// Name:        ax_mediactrlpanel.cpp
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     31/12/2008 18:16:16
// RCS-ID:      
// Copyright:   (c) Anthemion Software Limited
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#include "wx/wx.h"

////@begin includes
////@end includes

#if wxUSE_MEDIACTRL

#include "ax_resource/ax_mediactrlpanel.h"
#include "ax/ax_ui_adaptation_standard.h"

////@begin XPM images
////@end XPM images


/*
 * AxMediaCtrlPanel type definition
 */

IMPLEMENT_DYNAMIC_CLASS( AxMediaCtrlPanel, wxScrolledWindow )


/*
 * AxMediaCtrlPanel event table definition
 */

BEGIN_EVENT_TABLE( AxMediaCtrlPanel, wxScrolledWindow )

    EVT_TIMER(wxID_ANY, AxMediaCtrlPanel::Notify)

    EVT_MEDIA_LOADED(wxID_ANY, AxMediaCtrlPanel::OnMediaLoaded)
    EVT_MEDIA_FINISHED(wxID_ANY, AxMediaCtrlPanel::OnMediaFinished)

    EVT_COMMAND_SCROLL_THUMBTRACK(AxMediaCtrlPanel::ID_MEDIACTRLPANEL_TIME_SLIDER, AxMediaCtrlPanel::OnBeginSeek)
    EVT_COMMAND_SCROLL_THUMBRELEASE(AxMediaCtrlPanel::ID_MEDIACTRLPANEL_TIME_SLIDER, AxMediaCtrlPanel::OnEndSeek)

////@begin AxMediaCtrlPanel event table entries
    EVT_LISTBOX( ID_MEDIACTRLPANEL_PLAYLIST, AxMediaCtrlPanel::OnMediactrlpanelPlaylistSelected )

    EVT_BUTTON( ID_MEDIACTRLPANEL_PREVIOUS, AxMediaCtrlPanel::OnMediactrlpanelPreviousClick )
    EVT_UPDATE_UI( ID_MEDIACTRLPANEL_PREVIOUS, AxMediaCtrlPanel::OnMediactrlpanelPreviousUpdate )

    EVT_BUTTON( ID_MEDIACTRLPANEL_PLAY, AxMediaCtrlPanel::OnMediactrlpanelPlayClick )
    EVT_UPDATE_UI( ID_MEDIACTRLPANEL_PLAY, AxMediaCtrlPanel::OnMediactrlpanelPlayUpdate )

    EVT_BUTTON( ID_MEDIACTRLPANEL_STOP, AxMediaCtrlPanel::OnMediactrlpanelStopClick )
    EVT_UPDATE_UI( ID_MEDIACTRLPANEL_STOP, AxMediaCtrlPanel::OnMediactrlpanelStopUpdate )

    EVT_BUTTON( ID_MEDIACTRLPANEL_NEXT, AxMediaCtrlPanel::OnMediactrlpanelNextClick )
    EVT_UPDATE_UI( ID_MEDIACTRLPANEL_NEXT, AxMediaCtrlPanel::OnMediactrlpanelNextUpdate )

    EVT_SLIDER( ID_MEDIACTRLPANEL_VOLUME_SLIDER, AxMediaCtrlPanel::OnMediactrlpanelVolumeSliderUpdated )

////@end AxMediaCtrlPanel event table entries

END_EVENT_TABLE()


/*
 * AxMediaCtrlPanel constructors
 */

AxMediaCtrlPanel::AxMediaCtrlPanel()
{
    Init();
}

AxMediaCtrlPanel::AxMediaCtrlPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
    Init();
    Create(parent, id, pos, size, style);
}


/*
 * wxMediaCtrlPanel creator
 */

bool AxMediaCtrlPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
    wxScrolledWindow::Create( parent, id, pos, size, style );

    CreateControls();
    if (GetSizer())
    {
        GetSizer()->FitInside(this);
    }

    return true;
}


/*
 * AxMediaCtrlPanel destructor
 */

AxMediaCtrlPanel::~AxMediaCtrlPanel()
{
    m_timer.Stop();

////@begin AxMediaCtrlPanel destruction
////@end AxMediaCtrlPanel destruction
}


/*
 * Member initialisation
 */

void AxMediaCtrlPanel::Init()
{
    m_currentItem = -1;
    m_bIsBeingDragged = false;
    m_disableUpdates = false;
    m_autoPlay  = false;

////@begin AxMediaCtrlPanel member initialisation
    m_mediaCtrl = NULL;
    m_playlistCtrl = NULL;
    m_timerSliderCtrl = NULL;
    m_previousCtrl = NULL;
    m_playCtrl = NULL;
    m_stopCtrl = NULL;
    m_nextCtrl = NULL;
    m_volumeSliderCtrl = NULL;
////@end AxMediaCtrlPanel member initialisation
}


/*
 * Control creation for wxMediaCtrlPanel
 */

void AxMediaCtrlPanel::CreateControls()
{    
////@begin AxMediaCtrlPanel content construction
    AxMediaCtrlPanel* itemScrolledWindow1 = this;

    wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
    itemScrolledWindow1->SetSizer(itemBoxSizer2);

    wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer3->Add(itemBoxSizer4, 1, wxGROW, 5);

    m_mediaCtrl = new wxMediaCtrl( itemScrolledWindow1, ID_MEDIACTRLPANEL_MEDIACTRL, wxEmptyString, wxDefaultPosition, wxSize(100, 100), wxNO_BORDER );
    m_mediaCtrl->Show(false);
    itemBoxSizer4->Add(m_mediaCtrl, 1, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
    itemBoxSizer4->Add(itemBoxSizer6, 1, wxGROW, 5);

    wxStaticText* itemStaticText7 = new wxStaticText( itemScrolledWindow1, wxID_STATIC, _("&Playlist:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    wxArrayString m_playlistCtrlStrings;
    m_playlistCtrl = new wxListBox( itemScrolledWindow1, ID_MEDIACTRLPANEL_PLAYLIST, wxDefaultPosition, wxSize(120, -1), m_playlistCtrlStrings, wxLB_SINGLE );
    itemBoxSizer6->Add(m_playlistCtrl, 1, wxGROW|wxALL, 5);

    wxStaticText* itemStaticText9 = new wxStaticText( itemScrolledWindow1, wxID_STATIC, _("&Track position:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer3->Add(itemStaticText9, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);

    m_timerSliderCtrl = new wxSlider( itemScrolledWindow1, ID_MEDIACTRLPANEL_TIME_SLIDER, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
    itemBoxSizer3->Add(m_timerSliderCtrl, 0, wxGROW|wxALL, 5);

    wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxHORIZONTAL);
    itemBoxSizer3->Add(itemBoxSizer11, 0, wxGROW, 5);

    itemBoxSizer11->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL, 5);

    m_previousCtrl = new wxButton( itemScrolledWindow1, ID_MEDIACTRLPANEL_PREVIOUS, _("|<"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
    itemBoxSizer11->Add(m_previousCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);

    m_playCtrl = new wxButton( itemScrolledWindow1, ID_MEDIACTRLPANEL_PLAY, _(">"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
    itemBoxSizer11->Add(m_playCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);

    m_stopCtrl = new wxButton( itemScrolledWindow1, ID_MEDIACTRLPANEL_STOP, _("[]"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
    itemBoxSizer11->Add(m_stopCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);

    m_nextCtrl = new wxButton( itemScrolledWindow1, ID_MEDIACTRLPANEL_NEXT, _(">|"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
    itemBoxSizer11->Add(m_nextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);

    itemBoxSizer11->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    wxStaticText* itemStaticText18 = new wxStaticText( itemScrolledWindow1, wxID_STATIC, _("Volume:"), wxDefaultPosition, wxDefaultSize, 0 );
    itemBoxSizer11->Add(itemStaticText18, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);

    m_volumeSliderCtrl = new wxSlider( itemScrolledWindow1, ID_MEDIACTRLPANEL_VOLUME_SLIDER, 0, 0, 20, wxDefaultPosition, wxSize(80, -1), wxSL_HORIZONTAL );
    itemBoxSizer11->Add(m_volumeSliderCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);

    itemBoxSizer11->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL, 5);

////@end AxMediaCtrlPanel content construction

    // Do some specific adaptation due to labels not being readable
    AxSelfVoicing::AddAdapter(m_previousCtrl, new AxButtonAdapter(_("Previous track")));
    AxSelfVoicing::AddAdapter(m_nextCtrl, new AxButtonAdapter(_("Next track")));
    AxSelfVoicing::AddAdapter(m_playCtrl, new AxButtonAdapter(_("Play or pause track")));
    AxSelfVoicing::AddAdapter(m_stopCtrl, new AxButtonAdapter(_("Stop")));

    // Do the rest of the adaptation
    m_selfVoicing.Adapt(this);

    SetScrollRate(10, 10);

    m_volumeSliderCtrl->SetValue(m_volumeSliderCtrl->GetMax());
}


/*
 * Should we show tooltips?
 */

bool AxMediaCtrlPanel::ShowToolTips()
{
    return true;
}

/// Set current playlist
void AxMediaCtrlPanel::SetPlaylist(const wxArrayString& playlist, bool clearFirst)
{
    if (clearFirst)
    {
        m_playlist.Clear();
    }
    size_t i;
    for (i = 0; i < playlist.GetCount(); i++)
    {
        wxString f(playlist[i]);
        if (FindByFilename(f) == wxNOT_FOUND)
        {
            AxResource* resource = new AxResource;
            resource->SetFilename(f);
            resource->SetProperty(axPROPERTY_TITLE, wxFileNameFromPath(f));
            m_playlist.AddChild(resource);
        }
    }

    m_playlistCtrl->Clear();
    for (i = 0; i < m_playlist.GetCount(); i++)
    {
        m_playlistCtrl->Append(m_playlist.GetChild(i)->GetPropertyString(axPROPERTY_TITLE));
    }

    if (clearFirst)
        m_currentItem = 0;
}

void AxMediaCtrlPanel::SetPlaylist(const AxResource& playlist, bool clearFirst)
{
    if (clearFirst)
    {
        m_playlist.Clear();
    }
    size_t i;
    for (i = 0; i < playlist.GetCount(); i++)
    {
        wxString f(playlist.GetChild(i)->GetFilename());
        if (FindByFilename(f) == wxNOT_FOUND)
        {
            AxResource* res = wxDynamicCast(playlist.GetChild(i)->Clone(), AxResource);
            if (res)
                m_playlist.AddChild(res);
        }
    }

    m_playlistCtrl->Clear();
    for (i = 0; i < m_playlist.GetCount(); i++)
    {
        m_playlistCtrl->Append(m_playlist.GetChild(i)->GetPropertyString(axPROPERTY_TITLE));
    }

    if (clearFirst)
        m_currentItem = 0;
}

/// Find index of parts by filename
int AxMediaCtrlPanel::FindByFilename(const wxString& filename) const
{
    size_t i;
    for (i = 0; i < m_playlist.GetCount(); i++)
    {
        wxString f(m_playlist.GetChild(i)->GetFilename());
        if (f == filename)
        {
            return i;
        }
    }
    return -1;
}

/// Play. Choose first if idx is -1.
bool AxMediaCtrlPanel::Play(int idx)
{
    if (m_playlist.GetCount() == 0)
        return false;

    if (idx == -1)
        m_currentItem = 0;
    m_currentItem = idx;

    if (m_currentItem >= (int) m_playlist.GetCount())
        m_currentItem = 0;

    m_disableUpdates = true;
    m_playlistCtrl->SetSelection(idx);
    m_disableUpdates = false;

    wxString filename = m_playlist.GetChild(m_currentItem)->GetFilename();
    if (!wxFileExists(filename))
        return false;

    if (IsPlaying() || IsPaused())
        Stop();

    //wxURI uripath(filename);

    if (m_mediaCtrl->Load(filename))
    {
        return true;
        // return m_mediaCtrl->Play();
    }
    else
        return false;
}

/// Is the control playing?
bool AxMediaCtrlPanel::IsPlaying() const
{
    return (m_mediaCtrl->GetState() & wxMEDIASTATE_PLAYING) != 0;
}

/// Is the control paused?
bool AxMediaCtrlPanel::IsPaused() const
{
    return (m_mediaCtrl->GetState() & wxMEDIASTATE_PAUSED) != 0;
}

/// Pause
bool AxMediaCtrlPanel::Pause()
{
    return m_mediaCtrl->Pause();
}

/// Resume
bool AxMediaCtrlPanel::Resume()
{
    if (IsPaused())
        return m_mediaCtrl->Play();
    else
        return false;
}

/// Stop
bool AxMediaCtrlPanel::Stop()
{
    return m_mediaCtrl->Stop();
}

/// Clear playlist
void AxMediaCtrlPanel::ClearPlaylist()
{
    Stop();
    m_playlist.Clear();
    m_playlistCtrl->Clear();
}

/// Go to start of the current item
bool AxMediaCtrlPanel::GoToStart()
{
    m_mediaCtrl->Seek(0);
    return true;
}

/// Go to end of the current item
bool AxMediaCtrlPanel::GoToEnd()
{
    wxLongLong llLength = m_mediaCtrl->Length();
    m_mediaCtrl->Seek(llLength.GetValue());
    return true;    
}

/// Go to next item
bool AxMediaCtrlPanel::GoToNext()
{
    if (m_currentItem < (int) (m_playlist.GetCount()-1))
    {
        m_currentItem ++;
        return Play(m_currentItem);
    }
    else
        return false;
}

/// Go to previous item
bool AxMediaCtrlPanel::GoToPrevious()
{
    if (m_currentItem > 0)
    {
        m_currentItem --;
        return Play(m_currentItem);
    }
    else
        return false;
}

/*
 * Get bitmap resources
 */

wxBitmap AxMediaCtrlPanel::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin AxMediaCtrlPanel bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end AxMediaCtrlPanel bitmap retrieval
}

/*
 * Get icon resources
 */

wxIcon AxMediaCtrlPanel::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin AxMediaCtrlPanel icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end AxMediaCtrlPanel icon retrieval
}


/*
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_MEDIACTRLPANEL_GOSTART
 */

void AxMediaCtrlPanel::OnMediactrlpanelPreviousClick( wxCommandEvent& WXUNUSED(event) )
{
    GoToPrevious();
}


/*
 * wxEVT_UPDATE_UI event handler for ID_MEDIACTRLPANEL_GOSTART
 */

void AxMediaCtrlPanel::OnMediactrlpanelPreviousUpdate( wxUpdateUIEvent& event )
{
    event.Enable(m_currentItem > 0);
}


/*
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_MEDIACTRLPANEL_PLAY
 */

void AxMediaCtrlPanel::OnMediactrlpanelPlayClick( wxCommandEvent& WXUNUSED(event) )
{
    if (IsPaused())
        Resume();
    else if (IsPlaying())
        Pause();
    else if (m_currentItem != -1)
        Play();
    if (IsPlaying())
        m_playCtrl->SetLabel(wxT("||"));
    else
        m_playCtrl->SetLabel(wxT(">"));
}


/*
 * wxEVT_UPDATE_UI event handler for ID_MEDIACTRLPANEL_PLAY
 */

void AxMediaCtrlPanel::OnMediactrlpanelPlayUpdate( wxUpdateUIEvent& event )
{
    event.Enable(IsPaused() || IsPlaying());
}


/*
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_MEDIACTRLPANEL_STOP
 */

void AxMediaCtrlPanel::OnMediactrlpanelStopClick( wxCommandEvent& WXUNUSED(event) )
{
    Stop();
}


/*
 * wxEVT_UPDATE_UI event handler for ID_MEDIACTRLPANEL_STOP
 */

void AxMediaCtrlPanel::OnMediactrlpanelStopUpdate( wxUpdateUIEvent& event )
{
    event.Enable(IsPlaying());
}


/*
 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_MEDIACTRLPANEL_GOEND
 */

void AxMediaCtrlPanel::OnMediactrlpanelNextClick( wxCommandEvent& WXUNUSED(event) )
{
    GoToNext();
}


/*
 * wxEVT_UPDATE_UI event handler for ID_MEDIACTRLPANEL_GOEND
 */

void AxMediaCtrlPanel::OnMediactrlpanelNextUpdate( wxUpdateUIEvent& event )
{
    event.Enable(m_currentItem < (int) (m_playlist.GetCount()-1));
}


/*
 * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_MEDIACTRLPANEL_PLAYLIST
 */

void AxMediaCtrlPanel::OnMediactrlpanelPlaylistSelected( wxCommandEvent& event )
{
    if (m_disableUpdates)
        return;

    Play(event.GetSelection());
}

/// Finished
void AxMediaCtrlPanel::OnMediaFinished(wxMediaEvent& WXUNUSED(event))
{
    m_timer.Stop();

    if (GetAutoPlay() && m_currentItem < (int) (m_playlist.GetCount()-1))
        GoToNext();
}


/*
 * wxEVT_COMMAND_SLIDER_UPDATED event handler for ID_MEDIACTRLPANEL_VOLUME_SLIDER
 */

void AxMediaCtrlPanel::OnMediactrlpanelVolumeSliderUpdated( wxCommandEvent& WXUNUSED(event) )
{
    double value = (double(m_volumeSliderCtrl->GetValue()) / double(m_volumeSliderCtrl->GetMax()));
    m_mediaCtrl->SetVolume(value);
}

void AxMediaCtrlPanel::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
{
    if( !m_mediaCtrl->Play() )
    {
        wxMessageBox(_("Sorry, couldn't play this file."));
    }
    if (IsPlaying())
        m_playCtrl->SetLabel(wxT("||"));
    else
        m_playCtrl->SetLabel(wxT(">"));

    m_timer.SetOwner(this);
    m_timer.Start(500);
}

// ----------------------------------------------------------------------------
// MyNotebook::OnBeginSeek
//
// Sets m_bIsBeingDragged to true to stop the timer from changing the position
// of our slider
// ----------------------------------------------------------------------------
void AxMediaCtrlPanel::OnBeginSeek(wxScrollEvent& WXUNUSED(event))
{
    m_bIsBeingDragged = true;
}

// ----------------------------------------------------------------------------
// MyNotebook::OnEndSeek
//
// Called from file->seek.
// Called when the user moves the slider -
// seeks to a position within the media
// then sets m_bIsBeingDragged to false to ok the timer to change the position
// ----------------------------------------------------------------------------
void AxMediaCtrlPanel::OnEndSeek(wxScrollEvent& WXUNUSED(event))
{
    if( m_mediaCtrl->Seek(
            m_timerSliderCtrl->GetValue() * 1000
                                   ) == wxInvalidOffset )
        wxLogError(_("Couldn't seek."));

    m_bIsBeingDragged = false;
}

// Returns true if the user is dragging the slider
bool AxMediaCtrlPanel::IsBeingDragged()
{
    return m_bIsBeingDragged;
}

// ----------------------------------------------------------------------------
// Notify
//
// 1) Updates media information on the status bar
// 2) Sets the max/min length of the slider and guage
//
// Note that the reason we continually do this and don't cache it is because
// some backends such as GStreamer are dynamic change values all the time
// and often don't have things like duration or video size available
// until the media is actually being played
// ----------------------------------------------------------------------------
void AxMediaCtrlPanel::Notify(wxTimerEvent& WXUNUSED(event))
{
    // Number of minutes/seconds total
    wxLongLong llLength = m_mediaCtrl->Length();
    int nMinutes = (int) (llLength / 60000).GetValue();
    int nSeconds = (int) ((llLength % 60000)/1000).GetValue();
    
    // Duration string (i.e. MM:SS)
    wxString sDuration;
    sDuration.Printf(wxT("%2i:%02i"), nMinutes, nSeconds);    
    
    // Number of minutes/seconds total
    wxLongLong llTell = m_mediaCtrl->Tell();
    nMinutes = (int) (llTell / 60000).GetValue();
    nSeconds = (int) ((llTell % 60000)/1000).GetValue();
    
    // Position string (i.e. MM:SS)
    wxString sPosition;
    sPosition.Printf(wxT("%2i:%02i"), nMinutes, nSeconds);

    // Setup the slider and gauge min/max values
    m_timerSliderCtrl->SetRange(0, (int)(llLength / 1000).GetValue());
    // currentpage->m_gauge->SetRange(100);
    
    
    // if the slider is not being dragged then update it with the song position
    if(m_bIsBeingDragged == false)
        m_timerSliderCtrl->SetValue((long)(llTell / 1000).GetValue());    
    
#if 0
    // Update the gauge with the download progress
    wxLongLong llDownloadProgress =
        m_mediaCtrl->GetDownloadProgress();
    wxLongLong llDownloadTotal =
        m_mediaCtrl->GetDownloadTotal();
    
    if(llDownloadTotal.GetValue() != 0)
    {
        currentpage->m_gauge->SetValue(
            (int) ((llDownloadProgress * 100) / llDownloadTotal).GetValue()
            );
    }
#endif
    
#if 0
    // GetBestSize holds the original video size
    wxSize videoSize = m_mediaCtrl->GetBestSize();
    
    // Now the big part - set the status bar text to
    // hold various metadata about the media
#if wxUSE_STATUSBAR
    m_frame->SetStatusText(wxString::Format(
        wxT("Size(x,y):%i,%i ")
        wxT("Position:%s/%s Speed:%1.1fx ")
        wxT("State:%s Loops:%i D/T:[%i]/[%i] V:%i%%"),
        videoSize.x,
        videoSize.y,
        sPosition.c_str(),
        sDuration.c_str(),
        currentMediaCtrl->GetPlaybackRate(),
        wxGetMediaStateText(m_mediaCtrl->GetState()),
        currentpage->m_nLoops,
        (int)llDownloadProgress.GetValue(),
        (int)llDownloadTotal.GetValue(),
        (int)(m_mediaCtrl->GetVolume() * 100)));
#endif // wxUSE_STATUSBAR
#endif
}

#endif
